how to solve a recurrence relation